package com.xuecheng.base.config.xc;

import com.xuecheng.base.config.XxlJobProperties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.stereotype.Component;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: 自定义xxl-job配置
 * @date 2025/2/18 0:22
 */
@Data
@Component
@ConfigurationProperties(prefix = "xuecheng.xxl.job")
public class XCXxlJobProperties {

    /**
     * admin 相关配置
     */
    @NestedConfigurationProperty
    private XxlJobProperties.Admin admin;

    /**
     * executor 相关配置
     */
    @NestedConfigurationProperty
    private XxlJobProperties.Executor executor;

    /**
     * 访问令牌
     */
    private String accessToken;

    /**
     * xxl-job admin
     */
    @Data
    public static class Admin {

        /**
         * admin地址
         */
        private String addresses;
    }

    /**
     * xxl-job executor
     */
    @Data
    public static class Executor {

        /**
         * 执行器应用名
         */
        private String appName;

        /**
         * 执行器地址
         */
        private String address;

        /**
         * 执行器IP
         */
        private String ip;

        /**
         * 执行器端口
         */
        private Integer port;

        /**
         * 执行器日志路径
         */
        private String logPath;

        /**
         * 执行器日志保留天数
         */
        private Integer logRetentionDays;
    }
}
